package com.toman.camera;

import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;

import com.toman.R;
import com.toman.Util.SystemUtils;
import com.toman.Util.ToastUtil;
import com.example.swipebackactivity.app.SwipeBackActivity;
import com.githang.statusbar.StatusBarCompat;
import com.polites.android.GestureImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.squareup.picasso.Picasso;


/**
 * @Description: 预览 图片
 * @Author:杨攀
 * @Since:2014年8月9日下午5:46:09
 */
public class PreviewImgActivity extends SwipeBackActivity {


    @BindView(R.id.large_image)
    GestureImageView largeImage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 设置无标题
//        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //
        SystemUtils.fullScreen(this);
//        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_previewimg);
        ButterKnife.bind(this);
        ImageView imgView = (ImageView) this.findViewById(R.id.large_image);
        String imgpath = this.getIntent().getStringExtra("imgpath");// 图片路径
        ToastUtil.print("图片路径" + imgpath);
        StatusBarCompat.setStatusBarColor(this, getResources().getColor(R.color.white), true);

        if (imgpath.indexOf("http") >= 0) {
            Picasso.with(this).load(imgpath).noFade().into(imgView);
            //网络请求图片

        } else {
            imgView.setImageURI(Uri.parse(imgpath));
//“/”开头，表示图片路径, 在手机上存在的图片
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @OnClick(R.id.large_image)
    public void onViewClicked() {
        finish();
    }
}
